import axios from '../utils/request'
// users接口 get=> pararms post/put/delte => data

export const getTest = () => {
  return axios.get('/api/users/get-test')
}
/**
 * 验证码接口
 *
 */
export const getLoginCode = () => {
  return axios.get('/api/users/loginCode')
}
/**
 * 登陆
 *
 */
export const getLogin = (data) => {
  return axios.post('/api/users/login', data)
}
/**
 * @name 注册接口
 * @method POST
 * @param {data=>username, password, nickname, gender, avatar}
 */
export const getRegister = (data) => {
  return axios.post('/api/users/register', data)
}
/**
 *  @name 用户列表接口
 *  @method GET
 *  @param {params=>page=1, size=10}
 *
 */
export const getUserList = ({ params }) => {
  return axios.get('/api/users/list', { params })
}

// keywords
export const getUserSearch = ({ params }) => {
  return axios.get('/api/users/search', { params })
}
// blogs接口 restful api

export const getBlogList = (params) => {
  return axios.get('/api/blogs/list', { params })
}
export const addBlogList = (data) => {
  return axios.post('/api/blogs/list', data)
}
export const updateBlogList = (data) => {
  return axios.put('/api/blogs/list', data)
}

export const deleteBlogList = (data) => {
  return axios.delete('/api/blogs/list', data)
}
